package com.qzsoft.zhjd.warning.modules.warningasphaltconfig.entity;

import java.util.Date;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qzsoft.jeemis.common.validator.group.AddGroup;
import com.qzsoft.jeemis.common.validator.group.UpdateGroup;

import lombok.Data;

/**
 * @ClassName WarningAsphaltConfigEntity
 * @Description 沥青拌和楼配置
 * @author linhuawei
 * @since 2022-05-16
 */
@Data
@TableName("n_warning_asphalt_config")
public class WarningAsphaltConfigEntity {
    /**
     * 主键
     */
    @NotBlank(groups = UpdateGroup.class, message = "预警设置标识不可为空")
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    @NotBlank(groups = { AddGroup.class, UpdateGroup.class }, message = "拌合楼编号不能为空！")
    @Length(max = 7, message = "拌合楼编号格式错误")
    private String stationCode;

    /**
     * 是否温度预警：0否，1是
     */
    @NotNull(groups = { AddGroup.class, UpdateGroup.class }, message = "是否温度预警不能为空！")
    @Range(groups = { AddGroup.class, UpdateGroup.class }, min = 0, max = 1, message = "是否温度预警格式错误")
    private Integer temperature;

    /**
     * 是否级配预警：0否，1是
     */
    @NotNull(groups = { AddGroup.class, UpdateGroup.class }, message = "是否级配预警不能为空！")
    @Range(groups = { AddGroup.class, UpdateGroup.class }, min = 0, max = 1, message = "是否级配预警格式错误")
    private Integer sieve;

    /**
     * 是否油石比预警：0否，1是
     */
    @NotNull(groups = { AddGroup.class, UpdateGroup.class }, message = "是否油石比预警不能为空！")
    @Range(groups = { AddGroup.class, UpdateGroup.class }, min = 0, max = 1, message = "是否油石比预警格式错误")
    private Integer asphaltAggregateRatio;

    /**
     * 备注信息
     */
    private String info;

    /**
     * 添加人
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Date createDate;

    /**
     * 修改人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

    /**
     * 推送用户
     */
    @Valid
    @NotEmpty(groups = { AddGroup.class, UpdateGroup.class }, message = "推送用户不可为空")
    @TableField(exist = false)
    private List<WarningAsphaltUserEntity> users;

}
